package com.gz.tank;

public class Tank {
    private int x;//横坐标x
    private int y;//纵坐标y
    private int direct=0;//方向:0向上 1向右 2向下 3向左
    private int speed=2;
    boolean islive=true;

    public void setIslive(boolean islive) {
        this.islive = islive;
    }

    public boolean Islive() {
        return islive;
    }

    //移动方法
    public void moveup() {
        if(y-speed>0)
            y-=speed;
    }
    public void movedown() {
        if(y+speed+60<=750)
         y+=speed;
    }
    public void moveleft() {
        if(x-speed>0)
            x-=speed;
    }
    public void moveright() {
        if(x+60+speed<=1000)
            x+=speed;
    }
    public int getDirect() {
        return direct;
    }

    public void setDirect(int direct) {
        this.direct = direct;
    }

    public Tank(int x, int y) {
        this.x = x;
        this.y = y;
    }

    public int getSpeed() {
        return speed;
    }

    public void setSpeed(int speed) {
        this.speed = speed;
    }

    public int getY() {
        return y;
    }

    public void setY(int y) {
        this.y = y;
    }

    public int getX() {
        return x;
    }

    public void setX(int x) {
        this.x = x;
    }
}
